Skip to content

Adding Location Cache #2801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Aug 13, 2025
Merged

Adding Location Cache #2801

merged 24 commits into from
Aug 13, 2025

Conversation

gsa9989
Copy link
Contributor

@gsa9989 gsa9989 commented Jul 17, 2025

PR Summary:

  • Location cache is responsible for organizing the database account data gathered by the global endpoint manager. It holds the client’s preferred locations as well as lists of write and read regions separated by location and availability. Its purpose is to provide an available endpoint based on the client's preferred locations.
  • Added location cache functionality and tests.

Implementation details:

  • APIs include:
    • update
    • refresh_endpoints
    • refresh_stale_endpoints
    • get_endpoints_by_location
    • get_preferred_available_endpoints
    • mark_endpoint_unavailable
    • is_endpoint_unavailable
    • resolve_service_endpoint

Current limitations:

  • Currently does not support multi-write capabilities, planning to add it in a follow-up pr with global endpoint manager.

gsa9989 and others added 8 commits June 3, 2025 11:42
  ItemOptions-changes 41f2acf if_match_etag changes with tests
* main                b1d2f9f [origin/main] Merge pull request #1 from gsa9989/read-me-change
  read-me-change      653b308 read me change Please enter a commit message to explain why this merge is necessary,
  ItemOption-changes 41f2acf if_match_etag changes with tests
* main                b1d2f9f [origin/main] Merge pull request #1 from gsa9989/read-me-change
  read-me-change      653b308 merge upstream/main
…ter a commit message to explain why this merge is necessary,
@github-actions github-actions bot added the Cosmos The azure_cosmos crate label Jul 17, 2025
@gsa9989 gsa9989 changed the title Adding Global Endpoint Manager and Location Cache Adding Location Cache Aug 7, 2025
@gsa9989 gsa9989 marked this pull request as ready for review August 7, 2025 18:03
@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 18:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds location cache functionality to the Azure Cosmos SDK, providing a system to organize database account data and manage endpoint availability. The location cache tracks client preferred locations, available read/write regions, and endpoint availability to provide optimal endpoint selection for database operations.

Key Changes:

  • Added comprehensive location cache implementation with endpoint management and availability tracking
  • Implemented API methods for updating, refreshing, and resolving service endpoints
  • Added extensive test coverage for all location cache functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
sdk/cosmos/azure_data_cosmos/src/location_cache.rs Complete implementation of LocationCache with availability tracking, endpoint management, and comprehensive test suite
sdk/cosmos/azure_data_cosmos/src/lib.rs Added module declarations for location_cache and global_endpoint_manager
sdk/cosmos/azure_data_cosmos/src/global_endpoint_manager.rs Added empty GlobalEndpointManager struct placeholder

Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial stuff, but nothing significant! Looking good!

Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I think we're close! The currently build failure isn't your responsibility, it's an issue in a different crate that's also failing in main. We'll have to wait for it to be resolved before merging, but it shouldn't be an issue.

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @gsa9989
Though I am curious, do we need to add the license header on top of the location_cache.rs file?

@analogrelay
Copy link
Member

Ah, we do! Good catch @kushagraThapar . I'm bad at remembering that and we don't have any automation in place yet :(. @gsa9989 you can just grab the two comment lines from the top of any other Rust source file and add it in.

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gsa9989 gsa9989 merged commit 1e57604 into main Aug 13, 2025
17 checks passed
@gsa9989 gsa9989 deleted the gaby/global-endpoint-manager branch August 13, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cosmos The azure_cosmos crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants